import {Component} from '@angular/core';
import {User} from "../../../app/model/User";
import {Photo} from "../../../app/model/Photo";
import {RegisterServices} from "../../../app/services/http.register.services";
import {Router} from '@angular/router';



@Component({
    selector:'my-album',
    templateUrl:'app/component/album/my-album.component.html',
    styleUrls:['app/component/album/my-album.component.scss'],
    providers:[RegisterServices]
})

export class Album{
    private photos:Photo[];
    private user:User=new User();
    private selectPhoto:Photo=new Photo();
    constructor(
        private registerServices:RegisterServices,
        private router:Router){
            this.registerServices.getUserByName(window.localStorage.getItem("currentUserName")).subscribe(
                user=>{
                     this.registerServices.getPhotosByUser(user['_body']).subscribe(phto=>{
                          this.photos = JSON.parse(phto['_body']).photoList;
                     })
                }
            )
        }

}